<%@ Page Language="C#" MasterPageFile="~/StaffIntranet.Master" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="MCromwell.StaffIntranet.UI.Search" Title="Initech Staff Intranet" %>
<asp:Content ID="SearchContent" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
    

    <form id="frmSearch" action="Search.aspx" method="post" runat="server">
        <h1>Search for Staff</h1>
        <table id="search-form-layout-table">
            
            <tr>
                <th>First Name:</th>
                <td>
                    <asp:TextBox ID="txtFirstName" runat="server" MaxLength="255" TabIndex="1"></asp:TextBox></td>
            </tr>
            <tr>
                <th>Last Name:</th>
                <td>
                    <asp:TextBox ID="txtLastName" runat="server" MaxLength="255" TabIndex="2"></asp:TextBox></td>
            </tr>
            <tr>
                <th>Location:</th>
                <td>
                    <asp:DropDownList ID="ddlLocations" runat="server" TabIndex="3">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <th></th>
                <td align="right">
                    <asp:Button ID="btnSearch" runat="server" Text="Search" TabIndex="4" /></td>
            </tr>
            
        </table>
        
        <h1>Results</h1>
                
        <asp:GridView ID="grdStaffFound" runat="server" AutoGenerateColumns="False" 
            CssClass="result-table" CellPadding="2" CellSpacing="2" BorderStyle="None" 
            GridLines="None" AllowPaging="True" 
            OnPageIndexChanging="grdStaffFound_PageIndexChanging" 
            DataSourceID="StaffDataSource" PageSize="10" 
            onrowdatabound="grdStaffFound_RowDataBound" DataKeyNames="Id">
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
                <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
                <asp:BoundField DataField="MiddleName" HeaderText="MiddleName" SortExpression="MiddleName" />
                <asp:BoundField DataField="EmailAddress" HeaderText="EmailAddress" SortExpression="EmailAddress" />
                <asp:BoundField DataField="TelephoneNumber" HeaderText="TelephoneNumber" SortExpression="TelephoneNumber" />
                <asp:BoundField DataField="Extension" HeaderText="Extension" SortExpression="Extension" />
                <asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/View.aspx?StaffId={0}"
                    Text="View" />
                <asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/maintenance/Edit.aspx?StaffId={0}"
                    Text="Edit" Visible="False" />
                <asp:TemplateField Visible="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                            CommandName="delete" Text="Delete"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <RowStyle CssClass="result-row" BorderStyle="None" />
            <HeaderStyle CssClass="result-header" BorderStyle="None" />
        </asp:GridView>
        <asp:ObjectDataSource ID="StaffDataSource" runat="server" EnablePaging="True" 
            SelectMethod="RetrieveStaffForBinding" 
            TypeName="MCromwell.StaffIntranet.UI.Binding.StaffBindingProxy" 
            MaximumRowsParameterName="RowSize" SelectCountMethod="StaffCount" 
            StartRowIndexParameterName="RowIndex" OnSelecting="StaffDataSource_Selecting" 
            DeleteMethod="DeleteStaff" ondeleting="StaffDataSource_Deleting">
            <DeleteParameters>
                
            </DeleteParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="txtLastName" ConvertEmptyStringToNull="False" Name="LastName"
                    PropertyName="Text" Size="255" Type="String" />
                <asp:ControlParameter ControlID="txtFirstName" ConvertEmptyStringToNull="False" Name="FirstName"
                    PropertyName="Text" Size="255" Type="String" />
                <asp:ControlParameter ControlID="ddlLocations" ConvertEmptyStringToNull="False" Name="LocationId"
                    PropertyName="SelectedValue" Type="Int32" DefaultValue="-1" />
                             
                
            </SelectParameters>
        </asp:ObjectDataSource>
        &nbsp;&nbsp;
       
        
    </form>

</asp:Content>
